home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
INFO
/
DOSTRAIN.ZIP
/
NOTES.DOC
< prev
next >
Wrap
Text File
|
1988-09-07
|
12KB
|
241 lines
DOS CONCEPTS
The material on this disk is used to introduce the concept of a
program, the basic components of the computer
(input/output/memorystorage/CPU), the operating system, and the
relationship between a programs and data (in memory and on disk).
I. Demonstration Programs (*.EXE)
II. Source Programs (*.BAS)
III. Handouts (*.HDT)
IV. Assignments (*.AST)
V. Data Files (*.DAT)
I. Demonstration Programs
The following are descriptions of the demo programs on the disk
(in the order in which I introduce them):
PONG.EXE This program is used to illustrate loading and execution
of a program, followed by return to the operating system.
It needs no explanation, and loosens beginners up. I use it
the first class meeting, and lecture on the flow of informa-
tion from storage to memory as the program is loaded and the
transfer of control from the operating system to the program
then back to the operating system.
MORTGAGE.EXE This program computes mortgage payments, etc. It is
self-explanatory, but the user interface is rather poor. I
use it as a jumping off point for a discussion of the neces-
sity of carefully reading screen output and instructions,
the need to be skeptical of computer results, sources of
computer system error, and user interfaces and how this one
could be improved (see assignment 1). In other words, this
program is good because it's bad.
TTT.EXE This is a tic-tac-toe program. It makes the same points
as PONG, but is a better illustration of the idea of a se-
quentially executed program. I hand out a flowchart of the
program as well as an assignment designed to get the student
to think of it as a list of sequentially executed instruc-
tions.
PLAY.EXE This program is a tune editor, which can be used ini-
tally without saving/restoring tunes (i. e. without intro-
ducing the idea of a data file). A second assignment can
involve storing and restoring tunes. Unlike MAKEFILE, the
internal file structure is different than the screen dis-
play, which helps the student form a more general picture of
the relationship between a program and a data file. PLAY,
unlike the others, requires a little documentation (a two
page tutorial and/or a one-page reference).
MAKEFILE.EXE I use this program as a first illustration of the
idea of a data file, as opposed to a program file. The user
types in whatever he or she wishes (e. g. a joke), then
saves it in a file which can be printed (using PrtSc), dis-
played, copied, erased, etc.
II. Source Programs
The source programs are for the instructors use and modification.
I only use the compiled versions in class, because I do not wish
to introduce BASIC interpreter and it's relationship to the rest
of the system in the early class meetings.
PONG.BAS Source code for PONG, feel free to recompile it with a
different game "title" or whatever.
MORTGAGE.BAS Source code for MORTGAGE. This was taken from the
IBM DOS disk. THIS IS NOT PUBLIC DOMAIN MATERIAL!. USE THE
COPY ON YOUR DOS DISKETTE!
PLAY.BAS When a hard disk crashed, I lost my only copy of the
source to this program. I am sorry that I cannot give it to
you.
TTT.BAS Source code for TTT. TTT was originally developed as a
case study in a programming course. Therefore, I also have
a discussion and explication of the structure of the program
on a subroutine by subroutine basis, and a list of exercises
involving modification to the program.
MAKEFILE.BAS Source code for MAKEFILE.
III. Handouts
OSCOMM.HDT This file is a manual for a DOS subset. It neither
covers all the commands and constructs nor presents all of
the options for the commands it does cover. It is meant to
be the minimum needed to run canned application programs and
do light BASIC programming. This subset is enough to get
through the course, but the student is encouraged to read
the manual or other sources for enrichment.
The topics summarized in the handout are:
Drive Identifiers and File Names
Wildcards
Path names
The commands:
DIR
TYPE
ERASE
RENAME
<Program Name> (Load and execute the program)
FORMAT
COPY
CHDIR
PrtSc
Ctrl-p
Ctrl-Alt-Del
TTTFLOW.HDT The text for a flowchart of the TTT program. This
can be used as a handout (you have to draw the boxes and ar-
rows) to illustrate the idea of a program's sequential ex-
ecution. The assignment TTTFLOW.AST can be used with this
handout.
PLAY.HDT A tutorial and manual for the tune editor PLAY.EXE.
IV. Assignments
TTT.AST Usage: This assignment is to familiarize the student with
the components of the computer and the idea of a program.
The most interesting questions are the one on the move-
choice algorithm and the mortgage questions.
Move-choice: In discussing this, students invariably suggest
strategies which are vague, incomplete and anthropomorphic.
The solution illustrates the nature of a simple program.
Mortgage: If you use commas in the input values, this program
truncates the numbers (i. e. 100,000.00 would be read as
100). That makes for ridiculous answers, which some stu-
dents blithly turn in, opening up a discussion of GIGO, the
need to be careful in using computer output, programmer er-
rors, user errors, and hardware errors.
The output is also difficult to interperet, opening up a discus-
sion of program design. We discuss the redesign of the
program in order to better present the results and catch or
avoid input errors. The students come up with good ideas,
and this reinforces the idea of a program.
Answers:
1. Run the TTT program and answer the following questions:
What has the computer been programmed to do if you try moving to
a square that is already taken?
Display the message indicating that the square is occupied.
What has the computer been programmed to do if you try moving to
a square that does not exist, like square 10?
Display a message indicating that the legal moves are 1-9 only.
What has the computer been programmed to do if you try something
really strange, like moving to square HOHO?
Display a message indicating that the legal moves are 1-9 only.
What has the computer been programmed to do if you hold down the
CTRL key and type the letter C while playing the game?
Immediately stop execution of the application program and return
control to the operating system, which displays its prompt.
How has the computer been programmed to choose its next move?
You can spot the programmed pattern by playing several games
and watching what it does. Your answer should not be vague
or incomplete.
Take the center if it is open, otherwise take a corner, or if no
corners are open take a side. The ordering of priorities is
5, 1, 3, 7, 9, 2, 4, 6, 8.
2. Run the MORTGAGE program, and answer the following questions:
What is the monthly payment for a loan of $12,352 for 7 years at
an interest rate of 13%.
$224.71
If you borrow $100,000 at 13% for 30 years, your monthly payment
is $1,106.20. In the 319th month, how much of the payment
goes for interest and how much for principle?
Int: $402.65, prin: $703.55
PLAY.AST This assignment further illustrates the use of pre-
written program, the keyboard, and the relationship between
the application program and operating system. It requires
that the user read a manual, since I only describe it
briefly in class before making the assignment.
Usage:
This assignment also prepares the student for a discussion of the
distinction between a program and data (in memory and on
disk). After they have done this assignment, I ask them
where the tune "is" while you are working on it. Discussing
that question leads to the idea that the operating system,
the application program, and the data the program is working
with are all in memory while the program executes.
Next, I ask what would happen if they were interrupted and wanted
to save the tune they were working on; where would it be
saved? That leads to the concept of a data file in storage.
MAKEFILE.AST This assignment follows up on the idea of a data
file, requiring that they create one themselves. It also
introduces the DIR and TYPE operating system commands, as a
lead in to the next assignment.
Students must be shown how to format a disk before giving them
this assignment.
DOS.AST This assignment gives practice with the operating system
commands and solidifies the concept of data and program
files.
TTTFLOW.AST This assignment illustrates flowcharting and the idea
of a sequentially executing program. It requires the flow-
chart in TTTFLOW.HDT. This assignment is also useful when
introducing programming.
V. Data files
STRUC.DAT A small structured file to introduce the idea of files
and exercise DOS commands. You can also informally intro-
duce the ideas of records and fields if you wish.
TEXT.DAT A small test file to introduce the idea of files and ex-
ercise DOS commands.